<template>
	<view class="warn-container">
		<view class="topDetail">
			<view class="l">
				<view class="">
					<image style="width: 100%;height: 726rpx;" src="@/static/index/warnBgc.png" mode=""></image>
				</view>
				<view class="text">
				</view>
				<view class="button" style="border: none;">
				</view>
			</view>
		</view>
		<view class="warn-main" v-if="warnList.length">
			<view class="info">设备异常项检测</view>
			<view class="warn-item" v-for="(item,index) in warnList" :key="index">
				<view class="module color-title">
					<u-icon name="info-circle" color="#0066FF" size="18"></u-icon>
					<text>{{item.module}}</text>
				</view>
				<view class="title color-title">
					<view class="left">{{item.item}}</view>
					<view class="right" v-if="item.times">
						<u-icon name="warning-fill" color="#f00000" size="18"></u-icon>
						<text style="color: #f00000;">x{{item.times}}</text>
					</view>
				</view>
				<view class="title-text color-title-text">{{item.msg}}</view>
				<view class="content color-content">
					<!-- <text class="" v-html="item.recommend" style="word-break:break-all;"></text> -->
				</view>
			</view>
		</view>
		<view class="" style="margin-top: 100rpx;" v-else>
			<u-empty mode="data"  ></u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				warnList:[]
			};
		},
		onLoad(options) {
			this.warnInfo(options.sn)
		},
		methods:{
			async warnInfo(sn){
				const params = {
					sn
				}
				const res = await this.$fun.ajax.post('butt/deviceAlarmInfo',params)
				if(res.code===1){
					// res.data.forEach(i=>{
					// 	i.recommend = i.recommend.replace(/\n/g,'<br>')
					// })
					this.warnList = res.data
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #EEEEEE;
	}
	.color-title{
		color: #0066FF;
	}
	.color-title-text{
		color: #999;
	}
	.color-content{
		color: #3aa74a;
	}
.warn-container{
	.topDetail {
		width: 100%;
		display: flex;
		.l {
			width: 100%;
			text-align: center;
	
			image {
				width: 200rpx;
				height: 200rpx;
			}
	
			.text {
				color: rgb(81, 214, 206);
				font-size: 26rpx;
			}
	
			.button {
				margin-top: 20rpx;
				display: inline-block;
				padding: 10rpx 20rpx;
				border-radius: 30rpx;
				color: rgb(81, 214, 206);
				border: 2rpx solid rgb(81, 214, 206);
			}
		}
	
		.r {
			width: 50%;
			display: flex;
			flex-direction: column;
			justify-content: space-around;
	
	
		}
	}
	.warn-main{
		padding: 0 30rpx;
		position: relative;
		.info{
			position: absolute;
			left: 30rpx;
			right: 30rpx;
			top: -100rpx;
			background-color: #fff;
			text-align: center;
			padding: 35rpx;
			border-radius: 10rpx;
			margin-bottom: 5rpx;
			font-size: 32rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			color: #232323;
		}
		.warn-item{
			background-color: #fff;
			border-radius: 10rpx;
			margin-bottom: 20rpx;
			padding: 20rpx;
			box-shadow: 0 2rpx 10rpx #c3c3c3;
			.module{
				display: flex;
				margin: 5rpx 0;
				text{
					margin-left: 10rpx;
				}
			}
			.title{
				display: flex;
				justify-content: space-between;
				.left{
					display: flex;
					align-items: center;
					&::before{
						content: "";
						display: inline-block;
						width: 8rpx;
						height: 8rpx;
						background-color: #0066FF;
						margin-right: 10rpx;
					}
				}
				.right{
					display: flex;
					view:nth-child(1){
						margin-right: 10rpx;
					}
				}
			}
			.content{
				margin: 10rpx 0;
				font-size: 28rpx;
			}
		}
	}
}
</style>
